﻿Public Class PassCheck
    Dim blnVerified As Boolean = False

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim strPassword As String
        strPassword = "Password"
        If strPassword = TextBox1.Text Then
            blnVerified = True
            Me.Close()
        Else
            MsgBox("Incorrect Password Entered", MsgBoxStyle.Critical, "Incorrect Password")
            TextBox1.Text = ""
            TextBox1.Focus()

        End If
    End Sub


    Private Sub FrmLoad(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        TextBox1.PasswordChar = "*"
        Me.AcceptButton = Button1
        Me.CenterToScreen()
        TextBox1.Focus()
    End Sub

    Private Sub VerifyOnClose(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
        If blnVerified = True Then
            Environment.Exit(0)
        Else
            Environment.Exit(1)
        End If

    End Sub
End Class
